<?
//引入所有子系统信息
include_once("../../../common/script/extender_import.php");




//拿到nid，搜索一下停送日期，然后把该日期的订单都改成退款
$_stop_deliver_date=select_one_line_all_items($table_prefix."order_refund_apply_data","nid = '{$_REQUEST['nid']}'");

//print_r2($_stop_deliver_date);
//要处理的order_nid
$_order_nid=$_stop_deliver_date['order_nid'];


//2025-09-08 00:00:00,2025-09-09 00:00:00,2025-09-10 00:00:00,2025-09-11 00:00:00,2025-09-12 00:00:00,2025-09-15 00:00:00,2025-09-16 00:00:00,2025-09-17 00:00:00,2025-09-18 00:00:00,2025-09-19 00:00:00,2025-09-22 00:00:00,2025-09-23 00:00:00,2025-09-24 00:00:00,2025-09-25 00:00:00,2025-09-26 00:00:00,2025-09-28 00:00:00,2025-09-29 00:00:00,2025-09-30 00:00:00,2025-10-09 00:00:00,2025-10-10 00:00:00,2025-10-11 00:00:00,2025-10-13 00:00:00,2025-10-14 00:00:00,2025-10-15 00:00:00,2025-10-16 00:00:00,2025-10-17 00:00:00,2025-10-20 00:00:00,2025-10-21 00:00:00,2025-10-22 00:00:00,2025-10-23 00:00:00,2025-10-24 00:00:00,2025-10-27 00:00:00,2025-10-28 00:00:00,2025-10-29 00:00:00,2025-10-30 00:00:00,2025-10-31 00:00:00,2025-11-03 00:00:00,2025-11-04 00:00:00,2025-11-05 00:00:00,2025-11-06 00:00:00,2025-11-07 00:00:00,2025-11-10 00:00:00,2025-11-11 00:00:00,2025-11-12 00:00:00,2025-11-13 00:00:00,2025-11-14 00:00:00,2025-11-17 00:00:00,2025-11-18 00:00:00,2025-11-19 00:00:00,2025-11-20 00:00:00,2025-11-21 00:00:00,2025-11-24 00:00:00,2025-11-25 00:00:00,2025-11-26 00:00:00,2025-11-27 00:00:00,2025-11-28 00:00:00,2025-12-01 00:00:00,2025-12-02 00:00:00,2025-12-03 00:00:00,2025-12-04 00:00:00,2025-12-05 00:00:00,2025-12-08 00:00:00,2025-12-09 00:00:00,2025-12-10 00:00:00,2025-12-11 00:00:00,2025-12-12 00:00:00,2025-12-15 00:00:00,2025-12-16 00:00:00,2025-12-17 00:00:00,2025-12-18 00:00:00,2025-12-19 00:00:00,2025-12-22 00:00:00,2025-12-23 00:00:00,2025-12-24 00:00:00,2025-12-25 00:00:00,2025-12-26 00:00:00,2025-12-29 00:00:00,2025-12-30 00:00:00,2025-12-31 00:00:00,2026-01-04 00:00:00,2026-01-05 00:00:00,2026-01-06 00:00:00,2026-01-07 00:00:00,2026-01-08 00:00:00,2026-01-09 00:00:00,2026-01-12 00:00:00,2026-01-13 00:00:00,2026-01-14 00:00:00,2026-01-15 00:00:00,2026-01-16 00:00:00,2026-01-19 00:00:00,2026-01-20 00:00:00,2026-01-21 00:00:00,2026-01-22 00:00:00,2026-01-23 00:00:00,2026-01-26 00:00:00,2026-01-27 00:00:00,2026-01-28 00:00:00,2026-01-29 00:00:00,2026-01-30 00:00:00

$dateStr=$_stop_deliver_date['stop_deliver_date'];
// 处理日期字符串：分割为数组并为每个日期添加单引号
$dateArray = explode(',', $dateStr);
// 过滤空值（防止字符串末尾可能的空元素）
$dateArray = array_filter($dateArray);
// 为每个日期添加单引号
$quotedDates = array_map(function($date) {
    // 转义单引号（防止SQL注入风险）
    return "'" . addslashes(trim($date)) . "'";
}, $dateArray);
// 拼接为IN子句格式
$inClause = implode(',', $quotedDates);



$_sql="update ".$table_prefix."order_detail set status = '退款' where 
       order_nid = '{$_order_nid}' and ondate IN ({$inClause})";
do_query($_sql);


//把stop日期，都提出出来，然后循环改变状态
//$_stop_deliver_date_list=explode(",",$_stop_deliver_date['stop_deliver_date']);
//print_r2($_stop_deliver_date_list);






//把stop日期，都提出出来，然后循环改变状态
//foreach ($_stop_deliver_date_list as $_stop_deliver_date_list_item)
//{
//    $_sql="update ".$table_prefix."order_detail set status = '退款' where order_nid = '{$_order_nid}' and ondate = '{$_stop_deliver_date_list_item}'";
 //   do_query($_sql);
//}



?>


<!--//layui刷新整个敞口-->
<script>
    window.parent.location.reload();
</script>


